home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / util307.arc / BDNCHM.TXT < prev    next >
Text File  |  1987-03-04  |  896b  |  26 lines

  1. R
  2. FLOATING-POINT BENCHMARK  
  3.  
  4. The following is a program to test the accuracy of floating 
  5. point functions (from Sept. DR DOBBS):  
  6.      10 A=1                
  7.      20 FOR I%=1 TO 2499  
  8.      30   A=TAN(ATN(EXP(LOG(SQR(A*A))))) + 1 
  9.      40 NEXT   
  10.      50 PRINT A  
  11.      60 STOP 
  12.  
  13. The correct printout is A=2500 exactly.                                         
  14.  
  15. IBM-PC BASIC 1.0 fails miserably, giving A=2179.8 (only 1 sig-                  
  16. nificant figure of accuracy!).  In contrast, an APPLE II or                     
  17. Commodore 64 gives 2500 to at least 7 figures. Using the 8087 
  18. with a polyFORTH version of the benchmark, I obtained 2500 to
  19. 13 figures in 5.0 seconds. (NOTE: See March,84 D. DOBBS for
  20. the results aginst many systems.)
  21.  
  22.  
  23. Press ENTER to continue: 
  24. 13 figures in 5.0 seconds. (NOTE: See March,84 D. DOBBS for
  25. the results aginst many systems.)
  26.